/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sgs.persist;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author MaUrO FiLhO
 */
@Entity
@Table(name = "requisicao")
@NamedQueries({
    @NamedQuery(name = "Requisicao.findAll", query = "SELECT r FROM Requisicao r"),
    @NamedQuery(name = "Requisicao.findByIdRequisicao", query = "SELECT r FROM Requisicao r WHERE r.idRequisicao = :idRequisicao"),
    @NamedQuery(name = "Requisicao.findByUf", query = "SELECT r FROM Requisicao r WHERE r.uf = :uf"),
    @NamedQuery(name = "Requisicao.findByCarater", query = "SELECT r FROM Requisicao r WHERE r.carater = :carater"),
    @NamedQuery(name = "Requisicao.findByData", query = "SELECT r FROM Requisicao r WHERE r.data = :data"),
    @NamedQuery(name = "Requisicao.findByQuantidade", query = "SELECT r FROM Requisicao r WHERE r.quantidade = :quantidade"),
    @NamedQuery(name = "Requisicao.findByUnidade", query = "SELECT r FROM Requisicao r WHERE r.unidade = :unidade"),
    @NamedQuery(name = "Requisicao.findByDiscriminacao", query = "SELECT r FROM Requisicao r WHERE r.discriminacao = :discriminacao"),
    @NamedQuery(name = "Requisicao.findByPrazo", query = "SELECT r FROM Requisicao r WHERE r.prazo = :prazo"),
    @NamedQuery(name = "Requisicao.findByStatus", query = "SELECT r FROM Requisicao r WHERE r.status = :status")})
public class Requisicao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_requisicao")
    private Integer idRequisicao;
    @Basic(optional = false)
    @Column(name = "uf")
    private String uf;
    @Basic(optional = false)
    @Column(name = "carater")
    private String carater;
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @Column(name = "quantidade")
    private Integer quantidade;
    @Column(name = "unidade")
    private String unidade;
    @Column(name = "discriminacao")
    private String discriminacao;
    @Column(name = "prazo")
    @Temporal(TemporalType.DATE)
    private Date prazo;
    @Column(name = "status")
    private String status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "requisicao")
    private List<ItemRequsicao> itemRequsicaoList;
    @JoinColumn(name = "id_obra", referencedColumnName = "id_obra")
    @ManyToOne(optional = false)
    private Obra obra;
    @JoinColumn(name = "id_funcionario", referencedColumnName = "id_funcionario")
    @ManyToOne(optional = false)
    private Funcionario funcionario;
    @JoinColumn(name = "id_area", referencedColumnName = "id_area")
    @ManyToOne(optional = false)
    private Area area;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "requisicao")
    private List<Pedido> pedidoList;

    public Requisicao() {
    }

    public Requisicao(Integer idRequisicao) {
        this.idRequisicao = idRequisicao;
    }

    public Requisicao(Integer idRequisicao, String uf, String carater) {
        this.idRequisicao = idRequisicao;
        this.uf = uf;
        this.carater = carater;
    }

    public Integer getIdRequisicao() {
        return idRequisicao;
    }

    public void setIdRequisicao(Integer idRequisicao) {
        this.idRequisicao = idRequisicao;
    }

    public String getUf() {
        return uf;
    }

    public void setUf(String uf) {
        this.uf = uf;
    }

    public String getCarater() {
        return carater;
    }

    public void setCarater(String carater) {
        this.carater = carater;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public Integer getQuantidade() {
        return quantidade;
    }

    public void setQuantidade(Integer quantidade) {
        this.quantidade = quantidade;
    }

    public String getUnidade() {
        return unidade;
    }

    public void setUnidade(String unidade) {
        this.unidade = unidade;
    }

    public String getDiscriminacao() {
        return discriminacao;
    }

    public void setDiscriminacao(String discriminacao) {
        this.discriminacao = discriminacao;
    }

    public Date getPrazo() {
        return prazo;
    }

    public void setPrazo(Date prazo) {
        this.prazo = prazo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<ItemRequsicao> getItemRequsicaoList() {
        return itemRequsicaoList;
    }

    public void setItemRequsicaoList(List<ItemRequsicao> itemRequsicaoList) {
        this.itemRequsicaoList = itemRequsicaoList;
    }

    public Obra getObra() {
        return obra;
    }

    public void setObra(Obra obra) {
        this.obra = obra;
    }

    public Funcionario getFuncionario() {
        return funcionario;
    }

    public void setFuncionario(Funcionario funcionario) {
        this.funcionario = funcionario;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public List<Pedido> getPedidoList() {
        return pedidoList;
    }

    public void setPedidoList(List<Pedido> pedidoList) {
        this.pedidoList = pedidoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRequisicao != null ? idRequisicao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Requisicao)) {
            return false;
        }
        Requisicao other = (Requisicao) object;
        if ((this.idRequisicao == null && other.idRequisicao != null) || (this.idRequisicao != null && !this.idRequisicao.equals(other.idRequisicao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sgs.persist.Requisicao[idRequisicao=" + idRequisicao + "]";
    }

}
